#include <iostream>
#include <string>
#include <memory>
using std::cout;
using std::endl;
using std::string;
//例如：复杂对象：电脑
//      简单对象：主板、CPU、显卡、内存条
//建造者： 将简单对象汇总为一个整体，使用时不必关心底层构建细节


class Computer
{
    protected:
        string _board;
        string _display;
        string _os;
    public:
    Computer(){}
    virtual void setBoard(const string& name)
    {
        _board = name;
    }
    virtual void setDisplay(const string& name)
    {
        _display = name;
    }
    virtual void setOS();
};

class MacBook : public Computer
{
    private:
        string _board;
        string _display;
        string _os;    
    public:
        void setOS() override
        {
            _os = "MAC IOS12.0";
        }
};

class Buidler
{
    //先生产出零部件，再返回一个建造好的整体
    public:
    virtual void builderBoard(const string& board) = 0;
    virtual void builderDisplay(const string& display) =  0;
    virtual void builderOS() = 0;
};
class MacBookBuilder : public Buidler
{
    private:
        std::shared_ptr<Computer> _computer;
};